<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Vue中的JS动画与velocity.js</title>
	<script type="text/javascript" src="../js/vue.js"></script>
	<script type="text/javascript" src="../js/velocity.js"></script>
</head>
<body>
	<div id="app">
		<transition 
		  	name="fade"
			@before-enter="handleBeforeEnter"
			@enter="handleEnter"
			@after-enter="handleAfterEnter"		  	
		>
		<div v-show="show">Hello Vue.js</div>
		</transition>
		<button @click="change">转换</button>
	</div>
	<script type="text/javascript">
		var vm = new Vue({
			el: '#app',
			data: {
				show: true
			},
			methods: {
				change: function() {
					this.show = !this.show
				},
				handleBeforeEnter: function(el) {
					el.style.opacity = 0;
				},
				handleEnter: function(el, done) {
					Velocity(el, {
						opacity: 1
					}, {
						duration: 1000,
						complete: done
					})
				},
				handleAfterEnter: function(el) {
					console.log("结束")
				}
			}
		})
	</script>
</body>
</html>